package com.usian.admin.controller;

import com.usian.admin.service.AdsensitiveService;
import com.usian.apis.service.AdSensitiveService;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/api/sensitive")
@Api(value = "关键字管理",tags = "sensitive",description ="关键字管理api" )
public class AdsensitiveController implements AdSensitiveService {

    @Autowired
    private AdsensitiveService adsensitiveService;

    @PostMapping("list")
    @ApiOperation(value = "关键字查询",notes = "分页查询")
    @ApiImplicitParam(name = "sensitiveDto",type = "sensitiveDto",value = "分页参数")
    @Override
    public ResponseResult findnameBypage(@RequestBody SensitiveDto sensitiveDto) {
        return adsensitiveService.findBynameandpage(sensitiveDto);
    }

    @PostMapping("add")
    @ApiOperation(value = "敏感字添加",notes = "添加")
    @Override
    public ResponseResult add(@RequestBody AdSensitive adSensitive) {
        return adsensitiveService.add(adSensitive);
    }

    @PostMapping("edit")
    @ApiOperation(value = "敏感字修改",notes = "修改")
    @Override
    public ResponseResult edit(@RequestBody AdSensitive adSensitive) {
        return adsensitiveService.edit(adSensitive);
    }

    @PostMapping("del/{id}")
    @ApiOperation(value = "敏感字删除",notes = "删除")
    @Override
    public ResponseResult del(@PathVariable Integer id) {
        return adsensitiveService.del(id);
    }
}
